home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / c / gcc261ud-objc.lha / gnu / README-2.6.1 < prev   
Encoding:
Text File  |  1994-11-05  |  33.5 KB  |  882 lines

  1. Short: gcc v2.6.1 - C/C++/ObjC Compiler set for AmigaDOS
  2. Type: dev/gcc
  3. Uploader: phb@colombo.telesys-innov.fr
  4. Author: phb@colombo.telesys-innov.fr
  5.  
  6. This directory contains the 2.6.1 release of the GNU C compiler.
  7.  
  8. The GNU C compiler is free software.  See the file COPYING for copying
  9. permission.
  10.  
  11. ===============
  12. How to get help
  13. ===============
  14.  
  15. There's an amiga-gcc mailing list running in Finland, read README-LIST file.
  16. This is the preferred place to ask for help since I'm on this list and
  17. every GCC developers also, libnix & ixemul authors, etc...
  18.  
  19. Short: send an email to listserv@lists.funet.fi, and put in body:
  20.     subscribe amiga-gcc-port your_first_name your_last_name
  21.  
  22. Otherwise you can contact me at:
  23.  
  24.     Philippe BRAND
  25.     Fidonet: Ramses The Amiga Flying BBS 2:320/104.21
  26.     Email:   phb@colombo.telesys-innov.fr (ONLY for personal email).
  27.     Ftp:     colombo.telesys-innov.fr:/pub/amigados-gnu
  28.              or /pub/incoming/uploads for uploads.
  29.  
  30. Note: I'll forward any question to this mailing-list, but please use it
  31. directly, except when you send files, in this case send them to my ftp site.
  32.  
  33. Note2: ftp.funet.fi mirrors my amigados-gnu tree. Using ftp.funet.fi is
  34. preferable as they have much more bandwidth.
  35.  
  36. ============
  37. Requirements
  38. ============
  39.  
  40. - Systems:
  41. Any Amiga (ranging from A1000 up to A4000/40, including CD-32 & SX-1) will
  42. run amigados-gnu utilities.
  43.  
  44. - Memory:
  45. A minimum of 4MB free memory is needed in order to compile small/medium
  46. projects.
  47. More memory will be needed for large projects, such as recompiling gcc
  48. itself.
  49. Gigamem is known to work with GCC so *maybe* less memory will work. But in this
  50. case, you'll need an MMU equiped amiga (A3000,A4000/40, etc...).
  51. VMM40 (Public Domain Virtual memory manager) is also known to work with GCC.
  52.  
  53. - OS:
  54. Starting from this release, 1.3 systems are not longer supported.
  55. Gcc runs fine on all other systems, starting from 2.04 up to 3.1 (40.68).
  56.  
  57. - Disk Space;
  58. An installation of gcc requires the use of a hard disk. Approximately 10MB is
  59. required at present to install the compiler and utilities required to use it.
  60. In addition 3MB is required for the Commodore Developer Kit, which is required
  61. to be able to compile AmigaDOS specific programs. This kit is available direct
  62. from Commodore-Amiga.
  63.  
  64. ==========================
  65. What's new in this release
  66. ==========================
  67.  
  68. 2.6.1
  69.  
  70. - Read FSF NEWS-2.6.1 file included.
  71. - As always, generic bugs fixed (see Changelog in gcc sources for details).
  72. - complete guides for cpp/gcc/g++ included.
  73. - new option -priority in gcc allowing process priority setting. See note
  74.   below.
  75. - new specs file, inlines/protos and libamiga done by Gunther Nikl. See note
  76.   below.
  77. - new libnix version 0.6 by Matthias Fleischer & Gunther Nikl.
  78. - new ixemul version by Raphael Luebbert.
  79. - stripc program to strip all uneccessary stuff from headers by Chris Metcalf,
  80.   submitted by Lars Hecking.
  81. - q_anote, anotate assembly files mixing C source code, submitted by Walter
  82.   Harms (Walter.Harms@arbi.informatik.uni-oldenburg.de), written by 
  83.   Mike Albaugh (albaugh@agames.com). See note below.
  84. - new binutils (ar/ranlib/size/...) including new assembler, as-2.51, using new
  85.   BFD (Binary File Descriptor), made by Raphael Luebbert.
  86. - new utilities mit2mot & mot2mit, which translates Mit assembler syntax to
  87.   Motorola syntax and contrary, made by Rolf Spalink (rolf@cs.tu-berlin.de).
  88. - ManualBrowser included, replacing man command, courtesy of Christian Stieber,
  89.   assign MAN: to gnu:man and here you are.
  90.  
  91. =================================
  92. What was new in previous releases
  93. =================================
  94.  
  95. 2.6.0
  96.  
  97. - Read FSF NEWS-2.6.0 file included.
  98. - Extensive internal compiler bugs fixed (see ChangeLog in gcc sources for
  99.   details), tons of bugs fixed for C++ support.
  100. - ld changed (see note for ld below).
  101. - new ixemul.library, with optimized versions for accelerated Amigas, see
  102.   README-ixemul & ixemul.guide for more informations.
  103. - new C library (libnix) disabling use of ixemul.library for generated
  104.   programs (best use for AmigaDOS specific programs). Full ANSI compliant, see
  105.   README-libnix & libnix.guide for more informations.
  106. - revised inline headers in accordance with new ixemul.library.
  107. - libamiga.a is now distributed with gcc-2.6.1.
  108. - as v2.3 is included, along with a macro-assembler (gasp).
  109. - stderrfix.o (see below) patch applied.
  110. - Upgrade to libg++-2.6.
  111. - Gcc now supports $VER string for AmigaDOS version compatibility.
  112.  
  113. 2.5.8
  114.  
  115. - Read FSF NEWS-2.5.8 file included.
  116. - ld behavior over symbols changed (see note below).
  117. - added flavors so that linker will take appropriate libraries according to
  118.   gcc options (m68020 libraries/baserel libraries, etc...).
  119. - gpc (GNU-Pascal) v1.03 added.
  120. - all utilities recompiled with gcc-2.5.8.
  121. - plain 68000 and 68020+68881 versions of all binaries available.
  122. - More internal compiler bugs fixed (see ChangeLog in gcc sources for details),
  123.   some for C++ support.
  124. - GCC-Install script fixed by Claus Deckhut (to be used with full distrib).
  125. - Upgrade to libg++-2.5.3.
  126. - trace.c updated by J. Hoehle to avoid buffer overflows.
  127.  
  128. 2.5.7:
  129.  
  130. - Read FSF NEWS file included.
  131. - More internal compiler bugs fixed (see ChangeLog in gcc sources for details),
  132.   a lot for C++ support.
  133. - Fred Fish seems to have finally found an annoying bug which prevented
  134.   to compile a resident version of GCC, or to compile resident programs. But
  135.   don't try it anyway 'cause there's still lack of library support as for now.
  136. - Man command now works, this one was my fault (well in fact like others ;-),
  137.   fix done by Tom Haiko.
  138. - Infoview works also, it was an internal path problem.
  139. - libamy.a HAS TO BE RENAMED to libamiga.a because new ld won't find libamy.a
  140. - upgrade to new C++ library v2.5.1.
  141.  
  142. =======
  143. Authors
  144. =======
  145.  
  146. Gcc v2.2.2 port:   Markus Wild
  147. Gcc v2.3.3 port:   Markus Wild
  148. Gcc v2.4.5 port:   Philippe Brand, Lars Hecking, Fred Fish
  149. Gcc v2.5.0 and up: Philippe Brand, Fred Fish, Leonard Norrgard 
  150.  
  151. Ixemul.library:    Markus Wild, Leonard Norrgard, Raphel Luebbert
  152. Libnix:            Matthias Fleischer, Gunther Nikl
  153.  
  154. Thanks to all amiga-gcc-port mailing-list users for their reports and support
  155. for a better amigados-gcc and documentation.
  156.  
  157. =======
  158. Sources
  159. =======
  160.  
  161. These archives should contain everything necessary to get you going, they
  162. don't include sources for all tools (have a look at end of paragraph).
  163.  
  164. As stated by Richard Stallman of the FSF:
  165.  
  166. "The GPL says that any distribution of binaries must contain either the
  167. source code or a written offer to supply source code (see the GPL for
  168. details of what is required)."
  169.  
  170. If you're interested in the sources required to rebuild gcc, get the
  171. gcc261-src.lha, which hold sources for gcc. Those archives should be stored
  172. either the same ftp site you got this binary distribution from (if they're
  173. not, tell the manager of that ftp site, as this is a requirement of the
  174. GNU Copyright LICENSE), either at ftp.gnu.ai.mit.edu:/pub/gnu, either on
  175. Ramses BBS (phone numbers listed below).
  176.  
  177. If you have those archives, you can skip to next paragraph. If you have
  178. original FSF sources, you'll have to apply the gcc patch-file in src-patches/,
  179. and configure for `amigados'. Please note that you should have at least 40MB
  180. left or your HD and 8MB of memory minimum in order to rebuild gcc up to stage3.
  181. An accelerated Amiga is welcome, as it took me 4,5 hours to generate a single
  182. pass. So 3 passes makes 4,5 x 3 = 13,5 hours.
  183.  
  184. Sources for other tools only included as binaries are available separately
  185. in self-contained archives, usually having their name into the archive-name.
  186.  
  187. File                What
  188.  
  189. gcc261-src.lha            C/C++/ObjC compiler sources & diff file
  190. libnix-0.5.lha            libnix sources and binaries
  191. ixemul-40.3-src.lha        ixemul sources and libraries
  192. binutils-1.8.x-src.lha        Sources for ld/ar/ranlib & diff file
  193. binutils-2.5-src.lha        binutils sources & diff file
  194. gdbm-1.7.3-src.lha        Sources for gdbm & diff file
  195. make-3.71-src.lha        make sources & diff file
  196. patch-2.1-src.lha        patch sources, needed to apply diff files
  197. sed-2.05-src.lha        sed sources & diff file
  198. gawk-2.15.5-src.lha        GNU awk sources & diff file
  199. diffutils-2.6-src.lha        diff utility sources & diff file
  200. fileutils-3.9-src.lha        file utilities sources & diff file
  201. shellutils-1.9.4-src.lha    shell utilities sources & diff file
  202. textutils-1.9-src.lha        text utilities sources & diff file
  203. grep-2.0-src.lha        grep sources & diff file
  204. bison-1.22-src.lha        bison (yacc replacement) sources & diff file
  205. flex-2.4.6-src.lha        flex (lex replacement) sources & diff file
  206. texinfo-3.1-src.lha        texinfo (includes makeinfo) sources & diff file
  207. gzip-1.2.4-src.lha        gzip sources & diff file
  208. tar-1.11.2-src.lha        gtar sources & diff file
  209. cpio-2.3-src.lha        cpio sources & diff file
  210. find-3.8-src.lha        find sources & diff file
  211. gdbm-1.7.3-src.lha        database manip. library sources & diff file
  212. termcap-1.2-src.lha        termcap library sources & diff file
  213. libm-5.6-src.lha        BSD mathematic library sources & diff file
  214.  
  215.  
  216. NOTE:
  217. All sources archives are amiga ready, and amiga specific diff file located
  218. in 'amiga' directory. To recompile a tool, just run a 'configure amigados'
  219. then a 'make'.
  220. Exceptions are libnix, ixemul which have their own archives, both binary &
  221. sources.  On Aminet sites, libnix & ixemul in /pub/amiga/dev/gcc.
  222.  
  223. =====
  224. Where
  225. =====
  226.  
  227. **** All GNU sources & binaries are available on:
  228.  
  229. - ftp.telesys-innov.fr, primary Amiga-GNU FTP site, and its mirror ftp.funet.fi
  230.   which is MUCH faster than my own site. Please use it at first choice.
  231.     in /pub/amigados-gnu
  232.  
  233. - Aminet sites (wuarchive.wustl.edu and mirrors such as ftp.luth.se)
  234.     in /pub/amiga/dev/gcc
  235.  
  236. - Ramses The Amiga Flying BBS  +33-1-60037015  HST Dual v32 terbo 4800-21600
  237.                                +33-1-60037713  SupraFax v32bis    4800-14400
  238.                                +33-1-60037716  Tornado v22bis     1200-2400
  239.     in Topic "Development", Area "Gcc"
  240.  
  241. - FreshFish CDs from Fred Fish           Amiga Library Services
  242.     in :GNU/bin, :GNU/src, :GNU/lib dirs.  610 N. Alma School Road, Suite 18
  243.                        Chandler, AZ 85224-3687
  244.                        USA
  245.                        Fax: (602) 917-0917 (no voice phone
  246.                        orders, FAX only)
  247.  
  248. **** GNU source code is available on:
  249.  
  250. - same FTP site you've taken these archives
  251.  
  252. - gnu.prep.ai.mit.edu 18.71.0.38
  253.     in /pub/gnu
  254.  
  255. - Ramses The Amiga Flying BBS
  256.     in Topic "AmigaUnix/Unix/Linux/NetBSD", Area "Gnu Source Code"
  257.  
  258. - FreshFish from Fred Fish
  259.     in :GNU/src
  260.  
  261. ======
  262. Layout
  263. ======
  264.  
  265. Gcc-2.6.1 is split up into 14 archives:
  266.  
  267. gcc261-readme.lha    holds readmes files (include installation notes).
  268. gcc261-base.lha         basic gcc distribution, hold necessary files.
  269. gcc261-c.lha        C compiler.
  270. gcc261-c-020.lha    68020+68881 version of C compiler.
  271. gcc261-c++.lha        C++ compiler, headers and libraries.
  272. gcc261-c++-020.lha    68020+68881 versions of C++ compiler.
  273. gcc261-objc.lha        Objective-C compiler, header and libraries.
  274. gcc261-objc-020.lha    68020+68881 versions of Objective-C compiler.
  275. gcc261-doc.lha        Gcc AmigaGuide(tm) documents & manpages.
  276. gcc261-utils.lha    Useful utilities needed for development.
  277. gcc261-utilsdoc.lha    Utilities documentation (guide & manpages).
  278. gcc261-texi.lha        All Texinfo documents.
  279. gcc261-diffs.lha    Diff files for all binaries.
  280. gcc261-src.lha        Source for gcc-2.6.1 plus diff file.
  281.  
  282. Name            What                    Where    
  283. ----            ----                    -----
  284.  
  285. COPYING            GNU LICENSE, read!!            All archives
  286. COPYING.LIB        GNU LIBRARY LICENSE, read!!        All archives
  287. README-2.6.1        this file                All archives
  288. NEWS-2.6.1        What's new in gcc-2.6.1            gcc261-base
  289. Installer        Commodore installer utility        gcc261-base
  290. GCC-Install        Installer script to configure gcc    All archives
  291. envarc/            global environment variables you should
  292.             have set when using this programming    gcc261-base
  293.             environment
  294. include/        non-amiga specific C/C++ headers    gcc261-base
  295. os-include/proto    amiga specific protos headers.        gcc261-base
  296. os-include/inline    amiga specific inline C headers. Add    gcc261-base
  297.             Commodore headers!!        
  298. os-lib/            amiga specific libraries        gcc261-base
  299. guide/            Docs in AmigaGuide(tm) format        gcc261-doc
  300. man/            this is the root for tons of man pages    gcc261-doc
  301. bin/            this is /bin, and contains all         gcc261-c
  302.             binaries of this distribution that    gcc261-c++
  303.             are meant to be directly invoked by    gcc261-utils
  304.             the user (contrary to the executables
  305.                  in lib/gcc-lib/, that are meant to be
  306.             invoked by a driver program like gcc)
  307. lib/            normal (not base relatives) libraries    gcc261-base
  308. lib/libm020/        normal 68020 libraries            gcc261-base
  309. lib/libb/        base relatives libraries        gcc261-base
  310. lib/libb/libm020/    base relatives using 68020 libraries    gcc261-base
  311. lib/libnix/        Non-ixemul libraries            gcc261-base
  312. lib/libm020/libnix/    Non-ixemul 68020 libraries        gcc261-base
  313. lib/libb/libnix/    Non-ixemul base relatives libraries    gcc261-base
  314. lib/libb/libm020/libnix    Non-ixemul base relatives 68020 libs    gcc261-base
  315. lib/gcc-lib/        home of compilers called by gcc        gcc261-c
  316.                                 gcc261-c++
  317.                                 gcc261-objc
  318. ixpipe/            a pipe handler needed by the library    gcc261-base
  319. libs/            ixemul.library                gcc261-base
  320. rexx/            ARexx wrappers for gcc and g++        gcc261-base
  321. src-patches/        source patches                gcc261-diffs
  322. geninline/        Perl scripts to generate inline headers    gcc261-base
  323.             and -lamy glue
  324.  
  325. ==============
  326. Inline-Headers
  327. ==============
  328.  
  329. Since I'm not able to redistribute amiga header files, you will have to get
  330. them directly from Commodore, unless you're an official registrated Amiga
  331. developer. In order to generate inline-headers, follow these steps (provided
  332. amiga headers and fd files are in os-include). You don't have to generate them
  333. if you use OS3.1 (40.13 headers).
  334.  
  335. 1) First method:
  336.  
  337. CLI> stack 100000
  338. CLI> Assign INCLUDE: GCC:os-include
  339. CLI> Assign FD: INCLUDE:fd
  340. CLI> Makedir INCLUDE:inline
  341. CLI> cd USR:bin/geninline
  342. CLI> gen31
  343.  
  344. This will create all inline-headers. If you have 2.0 headers, use gen20
  345. instead, if you have 3.0, use gen30, if you have 6.4, send it to me ;-)
  346.  
  347. NOTE: perl scripts do not handle correctly AmigaDOS include files, which
  348. seems to mean they are somewhat broken. If someone could work on this...
  349.  
  350. 2) Second method:
  351.  
  352. Use fd2inline, which you can find on Aminet in dev/gcc.
  353.  
  354. ===============
  355. Amiga Libraries
  356. ===============
  357.  
  358. Starting from this release an AmigaDOS compliant library is provided,
  359. thanks to libnix authors (Matthias Fleischer and Gunther Nikl).
  360.  
  361. Anyway if you want to rebuild one, there are two methods:
  362.  
  363. 1) Using hunk2gcc; the AmigaDOS object converter made by Markus Wild. To
  364. achieve this, simply grab a copy of latest amiga.lib (from Commodore
  365. Development Kit) and make a new directory where you want your converted
  366. object files to go, cd into it, and enter
  367.  
  368.   hunk2gcc amiga.lib [..further libs if you like..]
  369.  
  370. This generates an a.out object file for every program unit present in the
  371. hunk file (in this case, from amiga.lib).
  372.  
  373. As the final step convert all those files into an a.out style library by
  374. issuing:
  375.  
  376.   ar qc libamiga.a obj.*
  377.   ranlib libamiga.a
  378.  
  379. The ranlib run builds a symbol table in the archive, and makes accesses to
  380. the library much faster.
  381.  
  382. 2) Creating a libamiga.a library with libnix is fairly easy, but takes some
  383. time. Just uncompress sources.lha from libnix distribution and run a
  384. 'make libamiga.a'.
  385.  
  386. NOTE:
  387.  
  388. As long as you make no AmigaDOs specific calls, you can create a dummy library
  389. using:
  390.  
  391.   cat "int dummy;" >dummy.c
  392.   gcc -c dummy.c
  393.   ar crv libamiga.a dummy.o
  394.   mv libamiga.a gcc:lib
  395.  
  396. A small libamiga.a (dummy) is also provided with libnix.
  397.  
  398. ============
  399. Installation
  400. ============
  401.  
  402. 1) If this is your first installation of GCC, follow these steps;
  403.  
  404. - You need first to create a directory gnu on your hard-disk and unarchive
  405. first part:
  406.     CLI> cd place_with_lot_of_space
  407.     CLI> makedir gnu
  408.     CLI> lha x gcc261-base.lha
  409.  
  410. - Now you have to append gnu/s/user-startup to your s:user-startup file
  411. (replace Devel:GNU by your own gnu path). Execute it in order to get new
  412. assigns:
  413.     CLI> execute gnu/s/user-startup
  414.  
  415. - Copy gnu/envarc to ENVARC:
  416.     CLI> copy gnu/envarc/#? ENVARC:
  417.  
  418. - C-compiler is needed so unarchive C compiler part (Users with
  419. accelerated amigas can unarchive gcc261-c-020 part instead) :
  420.     CLI> lha x gcc261-c.lha  (or gcc261-c-020)
  421.  
  422. - If you want to have Gcc documentation on-line, unarchive doc part:
  423.     CLI> lha x gcc261-doc.lha
  424.  
  425. - If you want to do C++, unarchive C++ part (Users with
  426. accelerated amigas can unarchive gcc261-c++-020 part instead) :
  427.     CLI> lha x gcc261-c++.lha (or gcc261-c++-020)
  428. Please not that 68020+68881 versions have '.020' extension in GNU:bin.
  429.  
  430. - If you want to do Objective-C, unarchive Objective-C part (Users with
  431. accelerated amigas can
  432.  unarchive gcc261-objc-020 part instead) :
  433.     CLI> lha x gcc261-objc.lha (or gcc261-objc-020)
  434.  
  435. - If you want additional utilities (recommended for Unix compatibility),
  436. unarchive utils part:
  437.     CLI> lha x gcc261-utils.lha
  438.  
  439. - If you want all utilities documentation no-line, unarchive utils-doc
  440. part:
  441.     CLI> lha x gcc261-utilsdoc.lha
  442.  
  443. - Because some programs are normally link to others, please run script:
  444.     CLI> sh /gnu/s/restorelinks
  445.   Or if you don't want to use makelink but rather copy file, run script:
  446.     CLI> sh /gnu/s/restorelinks copy
  447.  
  448. - If you want to rebuild all distribution, you'll have to unarchive
  449. diff part:
  450.     CLI> lha x gcc261-diffs.lha
  451.  
  452. - If you want to build Postscipt files for Gcc documention, unarchive
  453. texinfo part:
  454.     CLI> lha x gcc261-texi.lha
  455.  
  456. - Now skip to next paragraph and happy compiling!
  457.  
  458. 2) If you "upgrade" your gcc environment from v2.5.x, just unarchive first
  459.    2 archives as it would normally include all what you need (thus gcc261-base
  460.    and gcc261-c). Make sure you delete your previous ixemul.library
  461.    wherever it is (usually LIBS:).
  462.  
  463. NOTE:  new version of ixemul.library is provided, make sure you don't have
  464. another copy somewhere which may conflict with gcc.
  465.      
  466. =============================
  467. Your first C program with gcc
  468. =============================
  469.  
  470. What about a nice Hello World ?
  471.  
  472.     #include <stdio.h>
  473.  
  474.     main()
  475.     {
  476.       printf("Hello World!\n");
  477.     }
  478.         
  479. This was pretty simple ;-) Now we have to compile it.     
  480. There's a lot of options in gcc but simplest way to compile this would be:
  481.  
  482. CLI> gcc -o hello hello.c
  483.  
  484. Simple ?
  485.  
  486. Here's more options.
  487.  
  488. Target processor for Motorola family:
  489. You can compile plain 68000 code, 68020, 68030, 68040, 68881 (have a look at
  490. GCC documentation, either in info or AmigaGuide format, chapter Invoking Gcc/
  491. SubModel Options/M680X0 Options for Motorola specific compilation flags).
  492.  
  493. CLI> gcc -m68020 -m68881 -o hello hello.c
  494.  
  495. This will compile your programs using 68020 code and direct calls to
  496. math-processor, and will link with accelerated libraries, located in
  497. GCC:lib/lib020.
  498.  
  499. Optimization:
  500. Either you don't want optimization, or you can provide -O, which will 
  501. optimize your code, or if you really want top optimization, use -O2 flag (for
  502. more discussion about optimization, read info or AmigaGuide doc chapter
  503. Invoking Gcc/Optimize Options). There's now even a -O3 optimization option,
  504. which will go even further.
  505.  
  506. CLI> gcc -O2 -o hello hello.c
  507.  
  508. You'll never have a "Hello World" program running so fast ;-)
  509.  
  510. Code generation:
  511. Perhaps you want to generate resident programs.
  512. Flag is -resident, at compile and link stage.
  513.  
  514. CLI> gcc -resident -o hello hello.c
  515.  
  516. Of course you can mix all options, resulting in:
  517.  
  518. CLI> gcc -O2 -m68020 -m68881 -resident -o hello hello.c
  519.  
  520. This will make a 68020+68881 executable highly optimized and resident.
  521.  
  522. IMPORTANT:
  523. If you only use AmigaDOS functions or you don't want to use ixemul for
  524. philosophical reasons, you can get rid of ixemul.library with:
  525.  
  526. CLI> gcc -noixemul -o foobar foobar.c
  527.  
  528. provided you have libnix distribution (included with 2.6.1 distribution).
  529.  
  530. ================
  531. Ixemul vs Libnix
  532. ================
  533.  
  534. Starting with 2.6.0 version of amigados-gcc, two C libraries are provided.
  535.  
  536. First one is using ixemul.library Amiga shared-library at run-time. This
  537. library makes it possible to easily convert Unix(tm) programs to AmigaDOS,
  538. and made for example possible gcc on AmigaDOS. Have a look at ixemul.guide
  539. for further informations.
  540.  
  541. Second one is an ANSI-C compliant library which is better suited for
  542. AmigaDOS specific development, thus not using any Unix specific routines.
  543.  
  544. Note that you can develop AmigaDOS specific programs with ixemul.library,
  545. but at the cost of an extra 200KB memory taken by shared library.
  546.  
  547. ===============================
  548. Redirection with ixemul.library
  549. ===============================
  550.  
  551. A common problem seen with amigados-gcc is bad redirection to sderr.
  552.  
  553. The fact is that ixemul.library takes stderr from the pr_CES field
  554. in the process structure. The field was added in 2.0. If the field
  555. is not set, then ixemul uses stdout, instead. The trouble is that this
  556. field must be set by the shell, and the only shell that does so is
  557. WShell!
  558.  
  559. The rationale behind ixemul.library working this way is that
  560. "run <NIL: >NIL: cmd" will detach your process from the terminal, so
  561. that you can close the initial CLI window after startup.
  562.  
  563. In any case, there is a workaround for the problem that was posted to the
  564. list a while back: compile your main program using the -Dmain=mymain
  565. option, then link with stderrfix.o to provide the actual main that will
  566. do the magic that creates an stderr stream that is different from
  567. stdout. Along with the C version a C++ version is included and was used to
  568. compile groff.
  569.  
  570. Thanks to Kriton Kyrimis for this explanation and patch.
  571. stderr fixes can be found in GNU:stderrfix (srcs-) and GNU:lib (.o files).
  572.  
  573. =====
  574. ARexx
  575. =====
  576.  
  577. The provided ARexx scripts have been contributed by Loren J. Rittle.
  578. If you like ARexx, they're an alternate way of calling gcc. They 
  579. automatically make sure you're using a large enough stack setting, and 
  580. enable you to compile C++ programs with less obscure options. This 
  581. approach is furthermore useful if you're not able to use the g++ /bin/sh
  582. script.
  583.  
  584. ===============
  585. gcc versus gccv
  586. ===============
  587.  
  588. gccv stands for a gcc using vfork() to spawn a new process, and then calling
  589. the new execve() function in ixemul.library to call its subcompilers. Gcc
  590. continues to using the more system friendly RunCommand() function in
  591. dos.library to start subcompilers. Gccv has the advantage of being able to
  592. work with interprocess pipes, thus (provided you have the memory ;-)), you're
  593. able to do
  594.  
  595.     gccv -pipe your_program.c
  596.  
  597. causing the preprocessor (cpp), the C-compiler (cc1) and the assembler (as)
  598. to run at the same time, passing intermediate files thru internal pipes 
  599. instead of using temporary files.
  600.  
  601. As long as you don't want that feature (ok, playing with certain make tools
  602. also requires gccv) you're safe using gcc.
  603.  
  604. ==========
  605. stack size
  606. ==========
  607.  
  608. NEW: Work is being done to automagically set stack size, and to implement
  609. auto-stack growing code into gcc.
  610.  
  611. You need to have a 50.000 stack size in order to compile with GCC. This should
  612. be enough for most projects. Note than while recompiling gcc with itself it
  613. has taken more than 300KB stack. Stack can grow due to source complexity.
  614. Don't be afraid of it.
  615.  
  616. To set the stack size, see the AmigaDOS Command 'stack'. 
  617.  
  618. To use ar and/or ranlib, 50KB is the minimum acceptable. You should have a
  619. much larger stack, if you use larger libraries.
  620.  
  621. ===========
  622. C++ headers
  623. ===========
  624.  
  625. With AmigaDOS it makes no difference whether a name has capital or lower-case
  626. letters in names when finding files (i.e. it is case insensitive), you'll 
  627. certainly run into problems with some headers, including String.h and normal
  628. string.h. My suggestion for now is to add to C++ "faulty" header filename an
  629. "_" in front of it, thus String.h would become _String.h. Sorry for
  630. inconvenience. (thanks to Dirk Nehring for reminding me this anoying
  631. "feature").
  632.  
  633. =======
  634. Patches
  635. =======
  636.  
  637. Includes:
  638.  
  639.     Jörg Höhle
  640. hoehle@inf-wiss.uni-konstanz.de
  641.  
  642. There is a conflict between the Amiga and the UNIX definition of the
  643. timeval structure.  Markus Wild proposed in gcc233 to patch the Amiga
  644. devices/timer.h file so that it loads the UNIX sys/time.h file (and
  645. thus tons of other files) (see os-include/devices/timer.mwild.path). I
  646. suggest that sys/time.h and devices/timer.h be modified to detect each
  647. other and use whichever structure was declared first (see
  648. os-include/devices/timer.jch.patch). The supplied include/sys/time.h
  649. file works this way.  You can apply the patches with the program patch
  650. or by hand. The original devices/timer.h file is copyrighted by
  651. Commodore-Amiga and not included, but here is the patch:
  652.  
  653. + #ifndef _SYS_TIME_H_
  654. + /* Use whatever was included first, standard (sys/time.h) or Amiga
  655. +  * includes (jch). */
  656.   struct timeval {
  657.       ULONG tv_secs;
  658.       ULONG tv_micro;
  659.   };
  660. + #else
  661. + #define tv_secs  tv_sec
  662. + #define tv_micro tv_usec
  663. + #endif
  664.  
  665. The sys/types.h defined BPTR causing conflicts with Amiga includes. I
  666. removed the BPTR definition from sys/types.h and sys/proc.h. In
  667. gcc233, there was no such definition either.
  668.  
  669. I moved the ixemul.h file from include/ to the ixemlib/library/
  670. directory. The ixemlib/ directory could contain the ixemul.library
  671. sources. In the ixemul source tree, ixemul.h is found in the library/
  672. directory.  Furthermore I patched it so that it is now able to compile
  673. a working ixconfig. It was broken (because of the broken ixemul.h) in
  674. gcc252/3/4.  It previously worked in gcc233 but didn't provide the -e
  675. option. The ixemlib/library/version.h is an empty fake. I don't have a
  676. newer ixemul.h file.
  677.  
  678. There's yet another minor patch I'd like to suggest:
  679. *** include/stdlib.h.orig    Mon Aug 10 15:28:54 1992
  680. --- include/stdlib.h    Fri Dec 09 17:12:38 1993
  681. ***************
  682. *** 72,76 ****
  683. --- 72,80 ----
  684.   void    *calloc __P((size_t, size_t));
  685.   div_t     div __P((int, int));
  686. + #if 0
  687.   void volatile exit __P((int));
  688. + #else /* new ANSI-C interpretation */
  689. + typedef void exit_t __P((int)); volatile exit_t exit;
  690. + #endif
  691.   void     free __P((void *));
  692.   char    *getenv __P((const char *));
  693.  
  694. ===============
  695. Ld (GNU linker)
  696. ===============
  697.  
  698. Starting from 2.5.8 release, ld behavior over symbols has changed. Default is
  699. now to strip all symbols from generated executable ONLY if environment variable
  700. LDSTRIP is set (to whatever you want). Otherwise, '-s' flag will strip symbols,
  701. as usual.
  702. Also packing of uninitialized data will be done automatically if LDSHORTDATA is
  703. set (to whatever you want).
  704. Ld also knows about -chip and -fast keywords, gcc will soon handle them
  705. directly.
  706. Ld is using now flavors, which are generated depending on gcc flags:
  707.  
  708. Gcc option    Flavor passed to ld
  709. -m68020        -fl libm020
  710. -noixemul    -fl libnix
  711. -resident    -fl libb
  712.  
  713. Thus ld when searching for libraries, add to search library path those flavors,
  714. in alphabetical order. Normal search path is /gnu/lib, and if for example you
  715. want to compile using -m68020 -noixemul ld will look for libgcc.a in:
  716.     /gnu/lib/libm020/libnix
  717. first, then will reduce flavors, one by one, if it can't find required library
  718. in flavor's expanded path. This means that it will try to find libgcc.a in:
  719.     /gnu/lib/libm020
  720. and in  /gnu/lib/. because libgcc.a exists in /gnu/lib/libm020, ld will take
  721. this one.
  722.  
  723. There is as for now 8 possibilities:
  724.  
  725.     Flavors        Search path
  726. libb libm020 libnix
  727.  0      0      0    /gnu/lib/            normal
  728.  0      0      1    /gnu/lib/libnix/        non-ixemul
  729.  0      1      0    /gnu/lib/libm020/        normal 68020
  730.  0      1      1    /gnu/lib/libm020/libnix/    non-ixemul 68020
  731.  1      0      0    /gnu/lib/libb/            baserel
  732.  1      0      1    /gnu/lib/libb/libnix/        baserel non-ixemul
  733.  1      1      0    /gnu/lib/libb/libm020/        baserel 68020
  734.  1      1      1    /gnu/lib/libb/libm020/libnix/    baserel 68020 non-ix
  735.  
  736. Using this approach makes adding flavors pretty easily, if someone wants for
  737. example to add 68881 libraries, a new flavor will hve to be created, libm881,
  738. and thus maximum level flavor search path would be:
  739. /gnu/lib/libb/libm020/libm881/libnix, which can be translated in english as:
  740. "I want a base-relative library compiled using Motorola 68020 and coprocessor
  741. 68881, not using ixemul.library".
  742.  
  743. =======
  744. q_anote
  745. =======
  746.  
  747. Note: not yet working with 2.6.1
  748.  
  749.     This is the "package" for q_anote, the "quick anotation" tool
  750. to produce interspersed assembly/C listings. It is called "q_anote" to
  751. distinguish it from a more comprehensive tool we use here that produces
  752. such listing from a linked executable. I cannot distribute that one, as
  753. I did not write it and the person who did, did it on "company time". It
  754. also would not be very useful to the average person, as it uses an object
  755. file format descended from the Fraser & Hansen Portable linker. While
  756. philosophically similar to IEEE-695, it is not the same, and it is _very_
  757. different from the variations on a.out that GNU tools typically support.
  758.     Mike Albaugh (albaugh@agames.com)
  759.  
  760. Usage:
  761.  
  762. gcc -S foobar.c
  763. q_anote foobar.s
  764.  
  765. This will produce a foobar.asm, with mixed asm/C code.
  766. Use q_anote with no options to get usage.
  767.  
  768. ================
  769. Process Priority
  770. ================
  771.  
  772. Starting with 2.6.1 is a new option -priority included in gcc.
  773. It lets you specify a new AmigaDOS priority for gcc launched processes,
  774. including cpp/cc1/cc1plus/cc1obj.
  775. Default is -1, thus keeping gcc compiling at full speed unless you decide
  776. to do something else while compiling.
  777. New environment variable GCCPRIORITY, if set, will be read by compiler
  778. passes and set this new priority.
  779.  
  780. =====================
  781. gcc and its "pragmas"
  782. =====================
  783.  
  784. From Gunther Nikl:
  785.  
  786. Accessing operating-system functions on the amiga requires to pass arguments
  787. in specific processor registers. C, however, uses a different calling convention:
  788. it pushes all arguments in reverse order onto the stack, calls the function and
  789. finally removes the arguments from the stack by simply correcting the stack pointer.
  790. One solution to interface C and the calling convention for the system-functions are
  791. so called "glue"-functions that convert arguments passed on the stack into the
  792. os-function convention. These glue routines are located for all system libraries
  793. in a link library named libamiga.a. Obviously this method is inefficient. Most
  794. amiga c-compilers have the capability of in-line calls to os functions using
  795. a c language extension "#pragma". The format of a pragma statement and file names
  796. differ from compiler to compiler. gcc supports in-line calls too but not with
  797. pragmas. the gcc solution is based on the fact that gcc is able to integrate small
  798. functions into the caller. This method is known from c++ as "inlining". Thus
  799. functions that are declared "inline" (peferable in conjunction with the keyword
  800. static or extern but see the next chapter) get integrated. As you can see writing
  801. programs that compile with several compilers and use its capability of making
  802. in-line calls to libraries is a tricky thing.
  803.  
  804. To get programs more portable between amiga c-compilers a new set of include files
  805. would be helpful that hide the diffrent methods for in-line calls from the user.
  806. These files are located in a drawer called proto eg. "proto/exec.h". Instead of
  807. writing (only an example!):
  808.  
  809.     #include <clib/exec_protos.h>
  810.     #ifdef __GNUC__
  811.     #include <inline/exec.h>
  812.     #endif
  813.  
  814. now the following should be used:
  815.  
  816.     #include <proto/exec.h>
  817.  
  818. to achieve the same result! Nice, isn't it? The general rule for the all files is:
  819.  
  820.     #include <proto/xxx.h>
  821.  
  822. with "xxx" replaced with the first part of a clib proto-headers name eg.
  823. "exec_protos.h" becomes "exec.h"
  824.  
  825. In general each file first includes its function prototype header then the compiler
  826. specific "pragma" header and finally declares the library base extern. The gcc files
  827. are in the following format:
  828.  
  829.     (1) include some C= headers to prevent errors with gcc
  830.     (2) include the function prototypes from the clib drawer
  831.     (3) include the inline header if this is not disabled and if optimizing
  832.     (4) declare the library base extern if its not disabled
  833.  
  834. Step 3 will only be executed if gcc is optimizing. Otherwise the compiler won't
  835. integrate any function. Even when optimizing it could be not desired to include
  836. the inline header because it requires some amount of memory and the compile time
  837. enlarges significantly. Therefore step 3 can be disabled with:
  838.  
  839.     - a define on the commandline "-D__NOINLINES__"
  840.             or
  841.     - a define before the proto headers are included "#define __NOINLINES__"
  842.  
  843. Declaring the library base as an external variable can disabled with a define in
  844. the same way. The define is called "__NOLIBBASE__". This define can be useful if
  845. its not desired to have the library base declared extern.
  846.  
  847. Using the new proto headers has some advantages then using the clib and inline
  848. files by itself:
  849.  
  850.     (1) better compatibility with SAS/C. It should be much easier to compile
  851.         programs developed for SAS/C with gcc - almost ;) no need to adjust
  852.         includes
  853.     (2) almost ;) optimal code because depending on the optimization level
  854.         the best suited include set will be used
  855.     (3) internal compiler specific requirements are hidden from the user
  856.  
  857. For the exec.library the proto header has one additional goodie: it "implements"
  858. SAS/C "__USE_SYSBASE". Defining this forces to evaluate the absolute address 4
  859. every time the library base for the exec.library is required. In this case no
  860. global library base is necessary but it must be noted that programs compiled with
  861. this option enabled can have performance problems because AbsExecBase is located
  862. in Chip-Memory. Be aware: if using __USE_SYSBASE its *NOT* legal to declare or
  863. define SysBase! If you do so strange things may happen ... Please note that some
  864. function in libamiga.a require a global "SysBase" so that those functions cannot
  865. be used.
  866.  
  867. Some problems still remain but these restrictions come from the inline technique.
  868. Library bases have to be global due to the nature of the inlines. SAS/C, however,
  869. is able to use local variables or structure elements as library bases. In this case
  870. the library bases has to be made global for gcc.
  871.  
  872. inline headers
  873.  
  874. One major advantage of gcc is its ability to integrate simple functions into the
  875. caller. To direct the compiler to inline a function the keyword "inline" in
  876. combination with "static" or "extern" can be used. Previous version of the inlines
  877. used static in the definition. This had the effect that functions compiled to
  878. assembler if optimization is disabled. The new inline headers use extern definitions.
  879. Functions defined inline and extern can be considered as macros. That means the
  880. definition is only used for inlining thus requiring linking with a library containing
  881. stubs.
  882.